<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    <title>6.23. Readline-5.1</title>
    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
  <body id="lfs" class="6.2">
    <div class="navheader">
      <div class="headertitles">
        <h4>Linux From Scratch - 版本 6.2</h4>
        <h3>第六章 安装系统基础软件</h3>
      </div>
      <ul class="headerlinks">
        <li class="prev">
          <a accesskey="p" href="perl.html" title="Perl-5.8.8">后退</a>
          <p>Perl-5.8.8</p>
        </li>
        <li class="next">
          <a accesskey="n" href="zlib.html" title="Zlib-1.2.3">前进</a>
          <p>Zlib-1.2.3</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a></li>
      </ul>
    </div>
    <div class="wrap">
      <div class="titlepage">
        <h1 class="sect1">6.23. Readline-5.1</h1>
      </div>
      <div class="package">
        <p>Readline 软件包是一个提供命令行编辑和历史纪录功能的库集合。</p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">预计编译时间：</span></strong> <span class="seg">0.1 SBU</span>
            </div>
            <div class="seg">
              <strong><span class="segtitle">所需磁盘空间：</span></strong> <span class="seg">10.2 MB</span>
            </div>
          </div>
        </div>
      </div>
      <div class="installation">
        <div class="titlepage">
          <h2 class="sect2">6.23.1. 安装 Readline</h2>
        </div>
        <p>上游开发者已经修正了自从 Readline-5.1 之后版本的一些问题。应用这些修正：</p>
        <pre class="userinput"><kbd class="command">patch -Np1 -i ../readline-5.1-fixes-3.patch</kbd></pre>
        <p>重新安装 Readline 会将老的库libraryname重命名为&lt;libraryname&gt;.old。然而着并不是一个问题。在某些情况下它会引发<span><strong class="command">ldconfig</strong></span> 的一个链接bug。应用下面的两个sed命令可以避免这种情况： </p>
        <pre class="userinput"><kbd class="command">sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install</kbd></pre>
        <p>为编译 Readline 做准备：</p>
        <pre class="userinput"><kbd class="command">./configure --prefix=/usr --libdir=/lib</kbd></pre>
        <p>编译软件包：</p>
        <pre class="userinput"><kbd class="command">make SHLIB_LIBS=-lncurses</kbd></pre>
        <div class="variablelist">
          <p class="title">
            <b>make 选项的含义：</b></p>
          <dl>
            <dt>
              <span class="term"><em class="parameter"><tt>SHLIB_LIBS=-lncurses</tt></em></span>
            </dt>
            <dd>
              <p>这个选项强制 Readline 链接到 <tt class="filename">libncurses</tt> 库。</p>
            </dd>
          </dl>
        </div>
        <p>这个软件包没有附带测试程序。</p>
        <p>安装软件包：</p>
        <pre class="userinput"><kbd class="command">make install</kbd></pre>
        <p>给 Readline 动态库更多恰当的权限：</p>
        <pre class="userinput"><kbd class="command">chmod -v 755 /lib/lib{readline,history}.so*</kbd></pre>
        <p>将静态库移动到一个更合理的位置：</p>
        <pre class="userinput"><kbd class="command">mv -v /lib/lib{readline,history}.a /usr/lib</kbd></pre>
        <p>删除 <tt class="filename">/lib</tt> 中的 <tt class="filename">.so</tt> 文件，并将它们重新连接到 <tt class="filename">/usr/lib</tt> 中：</p>
        <pre class="userinput"><kbd class="command">rm -v /lib/lib{readline,history}.so
ln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.so
ln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so</kbd></pre>
      </div>
      <div class="content">
        <div class="titlepage">
          <a id="contents-readline" name="contents-readline"></a>
          <h2 class="sect2">6.23.2. Readline 的内容</h2>
        </div>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">安装的库：</span></strong> <span class="seg">libhistory.{a,so}, libreadline.{a,so}</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3><a id="id3682922" name="id3682922"></a>简要描述</h3>
          <table border="0">
            <col align="left" valign="top" />
            <tbody>
              <tr>
                <td><a id="libhistory" name="libhistory"></a><span class="term"><tt class="filename">libhistory</tt></span></td>
                <td><p>提供一个统一的调用历史行的用户接口</p></td>
              </tr>
              <tr>
                <td><a id="libreadline" name="libreadline"></a><span class="term"><tt class="filename">libreadline</tt></span></td>
                <td><p>应用于各种需要命令行接口的应用程序的统一的用户接口的辅助程序</p></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="perl.html" title="Perl-5.8.8">后退</a>
          <p>Perl-5.8.8</p>
        </li>
        <li class="next">
          <a accesskey="n" href="zlib.html" title="Zlib-1.2.3">前进</a>
          <p>Zlib-1.2.3</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a>.
        </li>
      </ul>
    </div>
</body></html>
